<extend name="Public/base"/>

<block name="body">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title">
        <h2>新增商圈</h2>
    </div>
    <form action="{:U('BusinessRange/add')}" method="post" class="form-horizontal">
        <div class="form-item">
            <label class="item-label">商圈名称<span class="check-tips">（请填写商圈名）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="area_name" value="">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">订单类型<span class="check-tips">（选择订单类型及限额）</span></label>
            <div class="controls ">
                <input class="pay_type_chose" type="checkbox" name="" value="1">  企业点餐  &nbsp; 限额 ：
                <input class="pay_type_chose" type="number" name="order1" value="0" disabled="disabled"> &nbsp;&nbsp;
                <input class="pay_type_chose" type="checkbox" name="order2" value="2" checked="checked">  拼团  &nbsp; 限额 ：
                <input class="pay_type_chose" type="number" name="order2" value="1" > &nbsp;&nbsp;
                <input class="pay_type_chose" type="checkbox" name="" value="1">  商超  限额 ：
                <input class="pay_type_chose" type="number" name="order3" value="0" disabled="disabled">
            </div>
        </div>
        <div class="form-item spell-work-time">
            <label for="" class="item-label">拼团进行时间 <span class="check-tips">(拼团开始到结束限时，单位为分钟)</span> </label>
            <div class="controls">
                <input type="number" name="work_time" value="30"> 分钟
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">商圈图片 <span class="check-tips">（请上传商圈图片）</span></label>
            <div class="controls">
                <div class="controls">
                    <input type="file" id="z_img1">
                    <input type="hidden" name="image_src" id="z_img_id1" value=""/>
                    <div class="upload-img-box"></div>
                </div>
                <script type="text/javascript">
                    //上传图片
                    /* 初始化上传插件 */
                    $("#z_img1").uploadify({
                        "height"          : 30,
                        "swf"             : "/Public/static/uploadify/uploadify.swf",
                        "fileObjName"     : "download",
                        "buttonText"      : "上传图片",
                        "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                        "width"           : 120,
                        'removeTimeout'	  : 1,
                        'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
                        "onUploadSuccess" : z_img_id1,
                        'onFallback' : function() {
                            alert('未检测到兼容版本的Flash.');
                        }
                    });
                    function z_img_id1(file, data){
                        var data = $.parseJSON(data);
                        var src = '';
                        if(data.status){
                            $("#z_img_id1").val(data.path);
                            src = data.url || '' + data.path
                            $("#z_img_id1").parent().find('.upload-img-box').html(
                                '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                            );
                        } else {
                            updateAlert(data.info);
                            setTimeout(function(){
                                $('#top-alert').find('button').click();
                                $(that).removeClass('disabled').prop('disabled',false);
                            },1500);
                        }
                    }
                </script>
            </div>


        </div>
        <div class="form-item">
            <label class="item-label">商圈地址<span class="check-tips">（请填写三级地名）</span></label>
            <!--<div class="controls">-->
            <!--&lt;!&ndash;<input type="text" class="text input-large" name="email" value="">&ndash;&gt;-->
            <!--<select name="address">-->
            <!--<option value="1">天津</option>-->
            <!--</select>-->
            <!--<select name="address">-->
            <!--<option value="1">南开</option>-->
            <!--</select>-->
            <!--<select name="address">-->
            <!--<option value="1">天拖</option>-->
            <!--</select>-->
            <!--</div>-->
            <div class="controls">
                <input type="text" name="region"> 区
                <input type="text" name="road"> 街道
                <input type="text" name="place"> 商圈
            </div>
        </div>
        <!-- <div class="form-item">
            <label class="item-label">工号<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="card" value="">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">所属单位<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="store" value="">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">姓名<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="name" value="">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">地址<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="address" value="">
            </div>
        </div> -->

        <div class="form-item">
            <label class="item-label">支付方式<span class="check-tips">（支付方式可多选）</span></label>
            <div class="controls">

                <foreach name = "payment" item="val">
                    <input type="checkbox" name="pay_type[]" value="{$val.pay_id}" > {$val.payment_name} &nbsp;&nbsp;
                </foreach>
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">是否热门<span class="check-tips"></span></label>
            <div class="controls">

                    <input type="radio" name="is_hot" value="1" > 热门 &nbsp;&nbsp;
                    <input type="radio" name="is_hot" value="0" checked="checked"> 一般

            </div>
        </div>

        <div class="form-item">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
//        highlight_subnav('{:U('Enterprise/index')}');
          $(".pay_type_chose").change(function(e){
              var index = $(this).index()+1;
              if($(this).is(':checked')){
                  $('.pay_type_chose').eq(index).attr('disabled',false);
                  if(index == 3){
                      $('.spell-work-time').show();
                  }
              }else{
                  $('.pay_type_chose').eq(index).attr('disabled',true);
                  if(index == 3){
                      $('.spell-work-time').hide();
                  }
              }
          })

    </script>
    <style>
        .spell-work-time{
            /*display: none;*/
        }
    </style>
</block>
